﻿namespace com.vs.General
{
    using System;
    using System.Collections;

    [Serializable]
    public class Session
    {
        private string[] _authorizedCompanyList;
        private string[] _authorizedWarehouseList;
        private string _companyAuthType;
        private string _connString = "Data Source=vpang;Initial Catalog=SCV;User ID=sa;Password=manh1234;Pooling=False";
        private string _currentWarehouse = "1";
        private string _environment;
        private DateTime _lastActivityDateTime;
        private DateTime _loginDateTime = DateTime.Now;
        internal string _machineName = "VPANG";
        private int _maximumRecordsAllowed = 0;
        private Hashtable _securityCheckpoints;
        private Guid _sessionId;
        private string _team;
        private string _user = "viktor";
        private string _warehouseAuthType;

        public Session()
        {
            this._lastActivityDateTime = this._loginDateTime;
            this._sessionId = Guid.NewGuid();
        }

        public virtual Session Clone()
        {
            Session session = SessionFactory.CreateSession();
            session.CurrentWarehouse = this._currentWarehouse;
            session.User = this.User;
            session.MaximumRecordsAllowed = this._maximumRecordsAllowed;
            return session;
        }

        public virtual void Dispose()
        {
        }

        public virtual string ConnectionString
        {
            get
            {
                return this._connString;
            }
            set
            {
                this._connString = value;
            }
        }

        public virtual string CurrentWarehouse
        {
            get
            {
                return this._currentWarehouse;
            }
            set
            {
                this._currentWarehouse = value;
            }
        }

        public virtual string Environment
        {
            get
            {
                return this._environment;
            }
            set
            {
                this._environment = value;
            }
        }

        public virtual DateTime LoginDateTime
        {
            get
            {
                return this._loginDateTime;
            }
        }

        public virtual int MaximumRecordsAllowed
        {
            get
            {
                return this._maximumRecordsAllowed;
            }
            set
            {
                this._maximumRecordsAllowed = value;
            }
        }

        private Hashtable SecurityCheckpoints
        {
            get
            {
                if (this._securityCheckpoints == null)
                {
                    this._securityCheckpoints = new Hashtable(100);
                }
                return this._securityCheckpoints;
            }
        }

        public virtual Guid SessionID
        {
            get
            {
                return this._sessionId;
            }
            set
            {
                this._sessionId = value;
            }
        }

        public virtual string Team
        {
            get
            {
                return null;
            }
            set
            {
                this._team = value;
            }
        }

        public virtual string User
        {
            get
            {
                return this._user;
            }
            set
            {
                this._user = value;
            }
        }
    }
}

